Make test 04_memset detect bug #380 and restart the console daemon.
authordan@guaranine.beaverton.ibm.com <dan@guaranine.beaverton.ibm.com>
Thu, 17 Nov 2005 10:56:13 +0000 (11:56 +0100)
committerdan@guaranine.beaverton.ibm.com <dan@guaranine.beaverton.ibm.com>
Thu, 17 Nov 2005 10:56:13 +0000 (11:56 +0100)
This should allow the rest of the tests to run without reporting
failure because this test killed the console system.

tools/xm-test/lib/XmTestLib/Console.py
tools/xm-test/tests/memset/04_memset_smallmem_pos.py

index 3c5691dc960941482e790f42dde02ab1e5ef614e..f502adc8592fe9b57d41b045f80f46fb043a1998 100755 (executable)
@@ -33,9 +33,13 @@ import select
 
 from Test import *
 
+TIMEDOUT = 1
+RUNAWAY  = 2
+
 class ConsoleError(Exception):
-    def __init__(self, msg):
+    def __init__(self, msg, reason=TIMEDOUT):
         self.errMsg = msg
+        self.reason = reason
 
     def __str__(self):
         return str(self.errMsg)
@@ -149,7 +153,7 @@ class XmConsole:
 
             if self.limit and bytes >= self.limit:
                 raise ConsoleError("Console run-away (exceeded %i bytes)"
-                                   % self.limit)
+                                   % self.limit, RUNAWAY)
 
         if self.debugMe:
             print "Ignored %i bytes of miscellaneous console output" % bytes
@@ -187,7 +191,7 @@ class XmConsole:
 
             if self.limit and bytes >= self.limit:
                 raise ConsoleError("Console run-away (exceeded %i bytes)"
-                                   % self.limit)
+                                   % self.limit, RUNAWAY)
 
             if str == "\n":
                 if lines > 0:
index 954707afcc3fe71a787c89aa16c7bfb26bb2f2c2..ebe5c5ba6605677b397d06820b951977274bb9e0 100644 (file)
@@ -36,6 +36,17 @@ try:
     # See if this hits the byte limit
     console.runCmd("ls")
 except ConsoleError, e:
-    FAIL(str(e))
+    if e.reason == RUNAWAY:
+        # Need to stop the domain before we restart the console daemon
+        domain.destroy()
+        if verbose:
+            print "*** Attempting restart of xenconsoled"
+            s, o = traceCommand("killall xenconsoled")
+            s, o = traceCommand("xenconsoled")
+            if s != 0:
+                print "*** Starting xenconsoled failed: %i" % s
+        FAIL("Bug #380: I crashed the console system")
+    else:
+        FAIL(str(e))
 
 domain.destroy()